//
//  teamRankViewCell.m
//  LiveSoftware
//
//  Created by lanou3g on 15/7/20.
//  strongright (c) 2015年 lanou3g. All rights reserved.
//

#import "teamRankViewCell.h"

#import "teamRankModel.h"

@interface teamRankViewCell ()

//描述
@property(nonatomic,strong)UILabel*rankingDesc;

/**
 *球队
 */
@property(nonatomic,strong)UILabel*teamName;

/**
 *状态
 */
@property(nonatomic,strong)UILabel*stat;


/**
 *轮
 */
@property(nonatomic,strong)UILabel *round;


/**
 *胜率
 */
@property(nonatomic,strong)UILabel *rate;


/**
 *总分
 */
@property(nonatomic,strong)UILabel*lose;



/**
 *排名
 */
@property(nonatomic,strong)UILabel *ranking;


/**
 *标题
 */
@property(nonatomic,strong)UILabel *title;


/**
 *赢
 */
@property(nonatomic,strong)UILabel*win;




@end
@implementation teamRankViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        
        CGFloat sideWidth = kScreenIp6(80);
        
        float partWidth = (kScreenWidth - sideWidth*2)/4;
        float partHeight = 35;
        
        float partX = 0;
        float partY = 0;
        
        
        
        
        //标题
        self.title = [[UILabel alloc]initWithFrame:CGRectMake(partX, partY, sideWidth, partHeight)];
        
        self.title.font = [UIFont systemFontOfSize:14];
        self.title.textAlignment = NSTextAlignmentCenter;

        self.title.text = @"";
        self.title.textColor = [UIColor grayColor];
        
        [self.contentView addSubview:_title];
        
        //排名
        self.ranking = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.title.frame),partY, partWidth  , partHeight)];
        self.ranking.font = [UIFont systemFontOfSize:14];
        self.ranking.textAlignment = NSTextAlignmentCenter;

        self.ranking.text = @"排名";
        
        [self.contentView addSubview:_ranking];
        
        
        
        
        
        //胜
        self.win = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.ranking.frame) , partY, partWidth,partHeight)];
        self.win.font = [UIFont systemFontOfSize:14];
        self.win.adjustsFontSizeToFitWidth = YES;
        self.win.textAlignment = NSTextAlignmentCenter;

        self.win.text = @"胜";
        [self.contentView addSubview:_win];
        
        
        
        //负
        self.lose = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.win.frame) ,partY,partWidth, partHeight)];
        self.lose.font = [UIFont systemFontOfSize:14];
        self.lose.textAlignment = NSTextAlignmentCenter;
        self.lose.text = @"负";
        self.lose.adjustsFontSizeToFitWidth = YES;
        
        [self.contentView addSubview:_lose];
        
        
        
        //胜率
        self.rate = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.lose.frame),partY,partWidth,partHeight)];
        self.rate.font = [UIFont systemFontOfSize:14];
        self.rate.textAlignment = NSTextAlignmentCenter;
        
        self.rate.text = @"胜率";
        [self.contentView addSubview:_rate];
        
        
        //连胜连负
        self.stat = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth - sideWidth, partY, sideWidth, partHeight)];
        self.stat.font = [UIFont systemFontOfSize:14];
        self.stat.textAlignment = NSTextAlignmentCenter;
        self.stat.text = @"连胜连负";
        [self.contentView addSubview:_stat];
        
        //线
        UIView *footLineView = [[UIView  alloc]initWithFrame:CGRectMake( 0, partHeight, kScreenWidth, 0.5)];
        
        footLineView.backgroundColor = [UIColor colorWithWhite:0.699 alpha:1.000];
        
        [self.contentView addSubview:footLineView];
        
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;

    }
    
    return self;
}

-(void)setCellValueWithModel:(teamRankModel*)model
{
    
    self.title.text = model.title;
    self.ranking.text = [NSString stringWithFormat:@"%@", model.ranking];
    self.win.text = [NSString stringWithFormat:@"%@", model.win];
    self.lose.text =[NSString stringWithFormat:@"%@", model.lose];
    self.rate.text = model.rate;
    self.stat.text = model.stat;
    
}



- (void)customTextColor
{
    self.win.textColor = [UIColor grayColor];
    self.lose.textColor = [UIColor grayColor];
    self.ranking.textColor = [UIColor grayColor];
    self.rate.textColor = [UIColor grayColor];
    self.stat.textColor = [UIColor grayColor];

}



@end
